package com.llkj.safeearth;

import android.app.Application;
import android.util.Log;
import cn.jpush.android.api.CustomPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;


/**
 * Created by zhangzhikai on 2018/5/4.
 */

public class SafeEarthApp extends Application {

	private static Application application;

	@Override
	public void onCreate() {
		super.onCreate();
		application = this;
		JPushInterface.setDebugMode(true);
		JPushInterface.init(this);
		CustomPushNotificationBuilder builder = new CustomPushNotificationBuilder(this, R.layout.customer_notitfication_layout, R.id.icon, R.id.title, R.id.text);
		builder.layoutIconDrawable = R.mipmap.ic_launcher;
		builder.developerArg0 = "developerArg2";
		JPushInterface.setPushNotificationBuilder(2, builder);

	}

	public static Application getInstance(){
		return application;
	}

	@Override
	public void onTerminate() {
		Log.e("Log","====onTerminate()=====");
		super.onTerminate();
		application = null;
	}

	public void stopPush(){
		JPushInterface.stopPush(getApplicationContext());
	}

	public void resumePush(){
		JPushInterface.resumePush(getApplicationContext());
	}


}
